package com.yyplatform.admin.infra.exception;

/**
 * Created on 2024-09-13
 */
public enum ErrorCode {
    SUCCESS(0, "OK"),

    INTERNAL_SERVER_ERROR(500, "内部异常"),
    UNAUTHORIZED(401, "未授权异常"),
    UNKNOW_ERROR(99, "未知异常"),

    // 参数校验
    PARAM_INVALID(10001, "参数不合法"),


    DB_KEY_DUMP(9004, "数据库key重复"),
    DB_RECORD_EXISTS(9001, "数据库记不存在"),
    DELETE_DATA_ERROR_SUBORDINATE_EXISTS(9002, "存在下级数据，无法删除"),
    DELETE_DATA_ERROR_IN_USE(9003, "数据正在使用中，无法删除"),


    // user模块
    USER_NOT_EXIST(200_001, "用户不存在"),
    PASSWORD_ERROR(200_002, "密码错误"),
    CAPTCHA_ERROR(200_003, "验证码错误"),

    JOB_TRIGGER_ERROR(100_001, "触发器错误"),

    //
    ;


    int code;
    String msg;

    ErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

}
